<template>
    <view class="splash" :class="{ hide: isHide }" @transitionend="onHidden">
        <image class="logo" src="/static/logo.png" mode="aspectFill" />
    </view>
</template>

<script setup>
import { ref } from 'vue'

const isHide = ref(false)

const emit = defineEmits(['hidden'])

const onHidden = () => {
    emit('hidden')
}

const hide = () => {
    isHide.value = true
}

defineExpose({
    hide
})
</script>

<style lang="scss" scoped>
.splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background-color: #FFFFFF;
    opacity: 1;
    transform: scale(1);
    transition: all .3s ease-in-out;
    z-index: 9;

    .logo {
        width: 190.84rpx;
        height: 190.84rpx;
    }

    &.hide {
        transform: scale(1.15);
        opacity: 0;
    }

    &.dark {
        background-color: #0F0F10;
    }
}
</style>